package net.lab1024.sa.admin.module.business.erp.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.erp.domain.entity.WageEntity;
import net.lab1024.sa.admin.module.business.erp.domain.form.add.WageAddForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.query.WageQueryForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.update.WageUpdateForm;
import net.lab1024.sa.admin.module.business.erp.domain.vo.WageVO;
import net.lab1024.sa.admin.module.business.erp.service.WageService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.concurrent.Semaphore;

/**
 * 工资 Controller
 *
 * @Author AKITA
 * @Date 2025-04-19 13:22:18
 * @Copyright AKITA
 */

@RestController
@Tag(name = "工资")
public class WageController {

    @Resource
    private WageService wageService;

    Semaphore semaphore = new Semaphore(0);

    @PostMapping("/wage/queryPage")
    public ResponseDTO<PageResult<WageVO>> queryPage(@RequestBody @Valid WageQueryForm queryForm) {
        return ResponseDTO.ok(wageService.queryPage(queryForm));
    }


    @PostMapping("/wage/add")
    public ResponseDTO<Long> add(@RequestBody @Valid WageAddForm addForm) {
        return wageService.add(addForm);
    }

    @PostMapping("/wage/update")
    public ResponseDTO<String> update(@RequestBody @Valid WageUpdateForm updateForm) {
        return wageService.update(updateForm);
    }


    @PostMapping("/wage/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return wageService.batchDelete(idList);
    }

    @GetMapping("/wage/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return wageService.delete(docEntry);
    }

    @GetMapping("/wage/info/{docEntry}")
    public ResponseDTO<WageEntity> info(@PathVariable Long docEntry) {
        return wageService.info(docEntry);
    }

    @PostMapping("/wage/excute")
    public ResponseDTO<String> excute(@RequestBody WageUpdateForm updateForm) {
        return wageService.excute(updateForm);
    }

    @GetMapping("/wage/share/{docEntry}")
    public ResponseDTO<String> shareController(@PathVariable Long docEntry) {
        return wageService.shareService(docEntry);
    }







}
